(DEFUN C:REROTTXT ()
  (SETQ txt_sample (ENTSEL))
  (IF (AND txt_sample (EQ (CDR (ASSOC 0 (ENTGET (CAR txt_sample)))) "TEXT"))
    (PROGN
      (SETQ samp_ent (ENTGET (CAR txt_sample)))
      (IF (WCMATCH (CDR (ASSOC 8 samp_ent)) "??VI##*")
        (SETQ samp_viewno (STRCAT "*" (SUBSTR (CDR (ASSOC 8 samp_ent)) 3 4) "*"))
        (SETQ samp_viewno "*")
      )
      (SETQ rotxt_ss (SSGET "X" (LIST (CONS 0 "TEXT")(CONS 8 samp_viewno)(CONS -4 "<NOT")(CONS 8 (STRCAT samp_viewno "[FGSWS][MSD]##*"))(CONS -4 "NOT>")(ASSOC 50 samp_ent)(ASSOC 410 samp_ent))))
      (SETQ cnt 0)
      (WHILE (< cnt (SSLENGTH rotxt_ss))
        (SETQ cntent (ENTGET (SSNAME rotxt_ss cnt)))
        (SETQ cntent (SUBST (CONS 50 (- 0 (GETVAR "viewtwist")))(ASSOC 50 cntent) cntent))
        (ENTMOD cntent)
        (ENTUPD (CDR (ASSOC -1 cntent)))
        (SETQ cnt (1+ cnt))
      )
    )
    (PROGN
      (PRINC "\nSelected entity is not a TEXT entity! ")
      (PRINC)
    )
  )
  (PRINC)
)